<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Plugin</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Plugin</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/vendor/rails/railties/lib/commands/plugin_rb.html">
                vendor/rails/railties/lib/commands/plugin.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000092">find</a>&nbsp;&nbsp;
      <a href="#M000098">info</a>&nbsp;&nbsp;
      <a href="#M000096">install</a>&nbsp;&nbsp;
      <a href="#M000095">installed?</a>&nbsp;&nbsp;
      <a href="#M000091">new</a>&nbsp;&nbsp;
      <a href="#M000094">svn_url?</a>&nbsp;&nbsp;
      <a href="#M000093">to_s</a>&nbsp;&nbsp;
      <a href="#M000097">uninstall</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">name</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">uri</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000092" class="method-detail">
        <a name="M000092"></a>

        <div class="method-heading">
          <a href="#M000092" class="method-signature">
          <span class="method-name">find</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000092-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000092-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 153</span>
153:   <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">name</span>)
154:     <span class="ruby-identifier">name</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\//</span> <span class="ruby-operator">?</span> <span class="ruby-identifier">new</span>(<span class="ruby-identifier">name</span>) <span class="ruby-operator">:</span> <span class="ruby-constant">Repositories</span>.<span class="ruby-identifier">instance</span>.<span class="ruby-identifier">find_plugin</span>(<span class="ruby-identifier">name</span>)
155:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000091" class="method-detail">
        <a name="M000091"></a>

        <div class="method-heading">
          <a href="#M000091" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(uri, name=nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000091-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000091-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 148</span>
148:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">name</span>=<span class="ruby-keyword kw">nil</span>)
149:     <span class="ruby-ivar">@uri</span> = <span class="ruby-identifier">uri</span>
150:     <span class="ruby-identifier">guess_name</span>(<span class="ruby-identifier">uri</span>)
151:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000098" class="method-detail">
        <a name="M000098"></a>

        <div class="method-heading">
          <a href="#M000098" class="method-signature">
          <span class="method-name">info</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000098-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000098-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 199</span>
199:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">info</span>
200:     <span class="ruby-identifier">tmp</span> = <span class="ruby-node">&quot;#{rails_env.root}/_tmp_about.yml&quot;</span>
201:     <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">svn_url?</span>
202:       <span class="ruby-identifier">cmd</span> = <span class="ruby-node">&quot;svn export #{@uri} \&quot;#{rails_env.root}/#{tmp}\&quot;&quot;</span>
203:       <span class="ruby-identifier">puts</span> <span class="ruby-identifier">cmd</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$verbose</span>
204:       <span class="ruby-identifier">system</span>(<span class="ruby-identifier">cmd</span>)
205:     <span class="ruby-keyword kw">end</span>
206:     <span class="ruby-identifier">open</span>(<span class="ruby-identifier">svn_url?</span> <span class="ruby-value">? </span><span class="ruby-identifier">tmp</span> <span class="ruby-operator">:</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-ivar">@uri</span>, <span class="ruby-value str">'about.yml'</span>)) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">stream</span><span class="ruby-operator">|</span>
207:       <span class="ruby-identifier">stream</span>.<span class="ruby-identifier">read</span>
208:     <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-node">&quot;No about.yml found in #{uri}&quot;</span>
209:   <span class="ruby-keyword kw">ensure</span>
210:     <span class="ruby-constant">FileUtils</span>.<span class="ruby-identifier">rm_rf</span> <span class="ruby-identifier">tmp</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">svn_url?</span>
211:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000096" class="method-detail">
        <a name="M000096"></a>

        <div class="method-heading">
          <a href="#M000096" class="method-signature">
          <span class="method-name">install</span><span class="method-args">(method=nil, options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000096-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000096-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 170</span>
170:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">install</span>(<span class="ruby-identifier">method</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">options</span> = {})
171:     <span class="ruby-identifier">method</span> <span class="ruby-operator">||=</span> <span class="ruby-identifier">rails_env</span>.<span class="ruby-identifier">best_install_method?</span>
172:     <span class="ruby-identifier">method</span>   = <span class="ruby-identifier">:export</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">method</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:http</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">svn_url?</span>
173: 
174:     <span class="ruby-identifier">uninstall</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">installed?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:force</span>]
175: 
176:     <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">installed?</span>
177:       <span class="ruby-identifier">send</span>(<span class="ruby-node">&quot;install_using_#{method}&quot;</span>, <span class="ruby-identifier">options</span>)
178:       <span class="ruby-identifier">run_install_hook</span>
179:     <span class="ruby-keyword kw">else</span>
180:       <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;already installed: #{name} (#{uri}).  pass --force to reinstall&quot;</span>
181:     <span class="ruby-keyword kw">end</span>
182:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000095" class="method-detail">
        <a name="M000095"></a>

        <div class="method-heading">
          <a href="#M000095" class="method-signature">
          <span class="method-name">installed?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000095-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000095-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 165</span>
165:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">installed?</span>
166:     <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-node">&quot;#{rails_env.root}/vendor/plugins/#{name}&quot;</span>) \
167:       <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">rails_env</span>.<span class="ruby-identifier">externals</span>.<span class="ruby-identifier">detect</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">repo</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">uri</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">repo</span> }
168:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000094" class="method-detail">
        <a name="M000094"></a>

        <div class="method-heading">
          <a href="#M000094" class="method-signature">
          <span class="method-name">svn_url?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000094-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000094-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 161</span>
161:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">svn_url?</span>
162:     <span class="ruby-ivar">@uri</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/svn(?:\+ssh)?:\/\/*/</span>
163:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000093" class="method-detail">
        <a name="M000093"></a>

        <div class="method-heading">
          <a href="#M000093" class="method-signature">
          <span class="method-name">to_s</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000093-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000093-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 157</span>
157:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
158:     <span class="ruby-node">&quot;#{@name.ljust(30)}#{@uri}&quot;</span>
159:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000097" class="method-detail">
        <a name="M000097"></a>

        <div class="method-heading">
          <a href="#M000097" class="method-signature">
          <span class="method-name">uninstall</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000097-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000097-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/rails/railties/lib/commands/plugin.rb, line 184</span>
184:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uninstall</span>
185:     <span class="ruby-identifier">path</span> = <span class="ruby-node">&quot;#{rails_env.root}/vendor/plugins/#{name}&quot;</span>
186:     <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
187:       <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Removing 'vendor/plugins/#{name}'&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$verbose</span>
188:       <span class="ruby-identifier">run_uninstall_hook</span>
189:       <span class="ruby-identifier">rm_r</span> <span class="ruby-identifier">path</span>
190:     <span class="ruby-keyword kw">else</span>
191:       <span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Plugin doesn't exist: #{path}&quot;</span>
192:     <span class="ruby-keyword kw">end</span>
193:     <span class="ruby-comment cmt"># clean up svn:externals</span>
194:     <span class="ruby-identifier">externals</span> = <span class="ruby-identifier">rails_env</span>.<span class="ruby-identifier">externals</span>
195:     <span class="ruby-identifier">externals</span>.<span class="ruby-identifier">reject!</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">n</span>,<span class="ruby-identifier">u</span><span class="ruby-operator">|</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">n</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">u</span>}
196:     <span class="ruby-identifier">rails_env</span>.<span class="ruby-identifier">externals</span> = <span class="ruby-identifier">externals</span>
197:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>